﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="Framework.WebmasterTool.Contacts.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chkAll").live("change", function () {
                if ($(this).is(":checked")) {
                    $(".checkbox").attr("checked", "checked");
                }
                else {
                    $(".checkbox").removeAttr("checked");
                }
            });
            $(".checkbox").live("click", function () {
                var allCheck = true;
                $(".checkbox").each(function () {
                    if (!$(this).is(":checked")) {
                        allCheck = false;
                        return;
                    }
                });
                if (allCheck == true) {
                    $("#chkAll").attr("checked", "checked");
                }
                else {
                    $("#chkAll").removeAttr("checked");
                }
            });
            $("#<%= btnDelete.ClientID %>").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                function (r) {
                    if (r) {
                        __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                    }
                });
                return false;
            });
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#spanClearDateSearch").click(function () {
                $("#<%= txtDateSearch.ClientID %>").val("");
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Quản lý liên hệ khách hàng
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div style="width: 765px; margin-bottom: 10px;" align="left">
            <span style="display: inline-block; float: left; margin-right: 5px">Lọc câu hỏi:
            </span>Ngày đăng:
            <asp:TextBox ID="txtDateSearch" runat="server"></asp:TextBox>
            <AjaxControlToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateSearch"
                Format="dd/MM/yyyy">
            </AjaxControlToolkit:CalendarExtender>
            <AjaxControlToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" MaskType="Date"
                ClearMaskOnLostFocus="true" TargetControlID="txtDateSearch" AcceptAMPM="false"
                Mask="99/99/9999" AutoComplete="false" InputDirection="LeftToRight" ErrorTooltipEnabled="true"
                MessageValidatorTip="true">
            </AjaxControlToolkit:MaskedEditExtender>
            <span id="spanClearDateSearch" style="cursor: pointer;">[x]</span>
            <asp:CheckBox ID="chkIsAnswered" runat="server" Text="Chưa trả lời" />
            <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div style="text-align: right;">
                        <asp:Button ID="btnGetMailServer" runat="server" Text="Lấy mail chưa đọc từ server mail"
                            OnClick="btnGetMailServer_Click" />
                        <asp:Button ID="btnOrder" runat="server" Text="Xem đơn hàng" OnClick="btnOrder_Click" />
                    </div>
                    <div style="margin: 10px;">
                        <asp:GridView runat="server" ID="grvContact" CssClass="grid" Width="765px" AutoGenerateColumns="False"
                            AllowPaging="True" AllowSorting="True" PagerSettings-Mode="NumericFirstLast"
                            PageSize="10" ToolTip="all" OnDataBinding="grvContact_DataBinding" OnPageIndexChanging="grvContact_PageIndexChanging"
                            OnSorting="grvContact_Sorting">
                            <Columns>
                                <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px">
                                    <HeaderTemplate>
                                        <input id="chkAll" type="checkbox" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <input id="chkSelect" runat="server" class="checkbox" type="checkbox" title='<%# Eval("ContactID") %>' />
                                    </ItemTemplate>
                                    <HeaderStyle Width="20px" />
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tiêu đề" SortExpression="Title" HeaderStyle-HorizontalAlign="Left"
                                    ItemStyle-HorizontalAlign="left">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTitle" runat="server" Text='<%# bool.Parse(Eval("ViewStatus").ToString()) == true ? Eval("Title") : "<B>" + Eval("Title") + "</B>"%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField SortExpression="AddedDate" HeaderText="Ngày đăng" ItemStyle-Width="120"
                                    ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="120">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hidfAddedDate" runat="server" Value='<%# Eval("AddedDate") %>' />
                                        <asp:Label ID="lblAddedDate" runat="server" Text='<%# String.Format("{0:dd/MM/yyyy HH:mm:ss tt}", (DateTime)(Eval("AddedDate")))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Trả lời" SortExpression="ReplyStatus"
                                    ItemStyle-Width="80" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="80">
                                    <ItemTemplate>
                                        <asp:CheckBox Enabled="false" Checked='<%# bool.Parse(Eval("ReplyStatus").ToString()) == true %>'
                                            ID="chk1" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-Width="40px" ItemStyle-Width="40px" HeaderText=""
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <a href="ContactDetails.aspx?ContactID=<%# Eval("ContactID") %>">
                                            <img src="<%= DGSFramework.Globals.ApplicationPath %>WebmasterTool/Images/Edit.gif"
                                                alt="" border="0" />
                                        </a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                <table align="center" width="765px" border="0" bgcolor="#ffffcc">
                                    <tr>
                                        <td height="50" align="center">
                                            <div align="center" id="EmptyData">
                                                Không có liên hệ khách hàng.</div>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                            <ProgressTemplate>
                                <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0;
                                    right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
                                    <img src="<%= DGSFramework.Globals.ApplicationPath %>WebmasterTool/Images/ajax-loader.gif"
                                        alt="Loading ..." title="Loading ..." style="padding: 10px; position: fixed;
                                        top: 45%; left: 45%" />
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnGetMailServer" EventName="Click" />
                    <asp:PostBackTrigger ControlID="grvContact" />
                    <asp:PostBackTrigger ControlID="btnOrder" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
        <div style="width: 765px; text-align: left">
            <asp:Button runat="server" ID="btnDelete" Text="Xoá các mục đã chọn" OnClick="btnDelete_Click" />
        </div>
    </asp:Panel>
</asp:Content>
